/**
 * 
 */
package hihocoder;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author zhongfang
 *
 */
public class H星人社交网络 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		double A[] = new double[n];
		for (int i = 0; i < n; i++) {
			A[i] = scanner.nextInt();
		}
		scanner.close();

		Arrays.sort(A);
		long sum = 0;
		for (int i = 0; i < A.length; i++) {
			double leftTarget = (0.125 * A[i] + 8);// 可以取等于
			double rightTarget = 8 * A[i] + 8;// 可以取等于
			if (A[i] < 88888) {
				rightTarget = Math.min(88888, rightTarget);
			}
			int leftIndex = Arrays.binarySearch(A, leftTarget);
			if (leftIndex < 0) {
				leftIndex = -leftIndex - 1;
			}

			int rightIndex = Arrays.binarySearch(A, rightTarget);
			if (rightIndex < 0) {
				rightIndex = -rightIndex - 1;
			}
			if (rightIndex < n && rightIndex >= 0 && A[rightIndex] == rightTarget) {// 可以取等于
				rightIndex++;
			}
			// index为>=目标值的下标
			int comb = rightIndex - leftIndex;// 1代表Ai自己
			if (i >= leftIndex && i < rightIndex) {
				comb--;
			}
			// System.out.println( A[i] + " " + leftTarget + " " + leftIndex + "
			// r" + rightTarget + " " + rightIndex + " " + comb);
			// 去除Ai<88888<Aj的情况
			sum += comb > 0 ? comb : 0;
		}
		System.out.println(sum);
	}

}
